import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm';
import { Enterprise } from './enterprise.entity';

@Entity()
export class Industry {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 255, comment: '行业名称' })
  name: string; // 行业名称

  @Column({ nullable: true, comment: '行业描述' })
  description: string; // 行业描述

  @ManyToMany(() => Enterprise, (enterprise) => enterprise.industries, {
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  enterprises: Enterprise[]; // 属于该行业的企业
}
